
//  KWNNetwork.m
//  KWNClient
//
//  Created by 张明磊 on 14-9-22.
//  Copyright (c) 2014年 张明磊. All rights reserved.
//

#import "KWNNetwork.h"
#import "KWNURLConnection.h"
#import "KWNURL.h"
#import <CommonCrypto/CommonDigest.h>
#import <UIKit/UIKit.h>
#import "Model_question.h"
#import "MKNetworkKit.h"
#import "Model_user.h"
#import "KWNDealData.h"
#import "Model_comment.h"

@interface KWNNetwork ()<NSURLConnectionDelegate>

@property (weak, nonatomic) NSURLConnection *connection;
@property (strong, nonatomic) requestResultBlock result_block;
@property (strong, nonatomic) requestResultBlock result_block_two;
@property (assign, nonatomic) NSInteger int_codeSign;

@property (strong, nonatomic) NSMutableData *webData;

@end

static KWNNetwork *networkManager = nil;

@implementation KWNNetwork

+ (KWNNetwork *)sharedInstance
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
            networkManager = [[self alloc] init];
    });
    return networkManager;
}

-(id)init{
    self = [super init];
    if (self) {
        _webData = [[NSMutableData alloc] init];
    }
    return self;
}

#pragma mark - 加密过程 -
/*
 加密过程
 */
- (NSString *)getSignWithArray:(NSMutableArray *)array_sort{
    [array_sort sortUsingSelector:@selector(compare:)];
    NSString *string_count = [NSString string];
    for (int i = 0; i < [array_sort count]; i++)
    {
        string_count = [string_count stringByAppendingString:[array_sort objectAtIndex:i]];
    }
    string_count = [string_count stringByAppendingString:YXSecret_key];

    NSString *string_result = [self md5HexDigest:string_count];
    return string_result;
}

#pragma mark - 举报 -
- (void)reportWithQuestionId:(NSString *)qId andReportStr:(NSString *)reportstr FinishBlock:(requestResultBlock)resultBlock
{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];

    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyreport",string_uid,qId,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
//    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    
    NSArray *array_object = @[@"lawyreport",string_uid,qId,reportstr,string_token,Model,Version,string_sign];
    NSArray *array_key = @[@"method",@"id",@"question_id",@"report",@"token",@"src",@"edition",@"sig"];
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjects:array_object forKeys:array_key];
    NSString *string_url = [KWNBaseURL_POST stringByAppendingString:@"lawyer/lawyreport"];
    MKNetworkOperation* op = [engine operationWithURLString:string_url params:dic httpMethod:@"POST"];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message)
            {
                [array_data addObject:@"系统发生错误"];
            }
            else
            {
                [array_data addObject:string_message];
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
//        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
//        _result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 32位md5加密 -
/*
 32位md5加密
 */
- (NSString *)md5HexDigest:(NSString*)input{
    if(input){
        const char* str = [input UTF8String];
        unsigned char result[CC_MD5_DIGEST_LENGTH];
        CC_MD5(str, (CC_LONG)strlen(str), result);
        NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2];
        for(int i = 0; i<CC_MD5_DIGEST_LENGTH; i++)
        {
            [ret appendFormat:@"%02x",result[i]];
        }
        return ret;
    }
    else
    {
        return nil;
    }
}

#pragma mark - 发送验证码 -
/**
 *  发送验证码
 */
//- (void)regist_sendCode:(NSString *)phone finishBlock:(requestResultBlock)resultBlock{
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"register",phone,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=register&mobile=%@&src=%@&edition=%@&sig=%@",phone,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    [theRequest setHTTPMethod:@"GET"];
//    theRequest.timeoutInterval = 15;
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_getMessage;
//    _result_block = resultBlock;
//}

- (void)regist_sendCode:(NSString *)phone finishBlock:(requestResultBlock)resultBlock{
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"register",phone,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/register?method=register&mobile=%@&src=%@&edition=%@&sig=%@",phone,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message)
            {
                [array_data addObject:@"系统发生错误"];
            }
            else
            {
                [array_data addObject:string_message];
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 重新发送验证码 -
/**
 *  重新发送验证码
 */
//- (void)regist_reSendCode:(NSString *)phone finishBlock:(requestResultBlock)resultBlock{
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"recode",phone,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=recode&mobile=%@&src=%@&edition=%@&sig=%@",phone,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    [theRequest setHTTPMethod:@"GET"];
//    theRequest.timeoutInterval = 15;
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_reSendCode;
//    _result_block = resultBlock;
//}

- (void)regist_reSendCode:(NSString *)phone finishBlock:(requestResultBlock)resultBlock{
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"recode",phone,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/recode?method=recode&mobile=%@&src=%@&edition=%@&sig=%@",phone,Model,Version,string_sign]];

    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message)
            {
                [array_data addObject:@"系统发生错误"];
            }
            else
            {
                [array_data addObject:string_message];
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}


#pragma mark - 校验验证码 -
/**
 *  校验验证码
 */
//- (void )regist_verifyPhone:(NSString *)phone andCode:(NSString *)code finishBlock:(requestResultBlock)resultBlock{
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"testcode",phone,code,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=testcode&mobile=%@&code=%@&src=%@&edition=%@&sig=%@",phone,code,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    [theRequest setHTTPMethod:@"GET"];
//    theRequest.timeoutInterval = 15;
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_verifyPhone;
//    _result_block = resultBlock;
//}
- (void )regist_verifyPhone:(NSString *)phone andCode:(NSString *)code finishBlock:(requestResultBlock)resultBlock{
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"testcode",phone,code,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/testcode?method=testcode&mobile=%@&code=%@&src=%@&edition=%@&sig=%@",phone,code,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message)
            {
                [array_data addObject:@"系统发生错误"];
            }
            else
            {
                [array_data addObject:string_message];
                NSString *string_uid = [kindDic objectForKey:@"id"];
                if(string_uid){
                    [array_data addObject:string_uid];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 设置密码 -
/**
 *  设置密码
 */
//- (void )regist_setPassword:(NSString *)password andUid:(NSString *)string_uid finishBlock:(requestResultBlock)resultBlock{
//    NSString *string_dToken = [[Model_user sharedInstance] getDeviceToken];
//    if(!string_dToken){
//        string_dToken = @"";
//    }
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"setlawypassword",string_uid,password,string_dToken,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=setlawypassword&id=%@&userpass=%@&udid=%@&src=%@&edition=%@&sig=%@",string_uid,password,string_dToken,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_finish;
//    _result_block = resultBlock;
//}

- (void )regist_setPassword:(NSString *)password andUid:(NSString *)string_uid finishBlock:(requestResultBlock)resultBlock{
    NSString *string_dToken = [[Model_user sharedInstance] getDeviceToken];
    if(!string_dToken){
        string_dToken = @"";
    }
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"setlawypassword",string_uid,password,string_dToken,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/setlawypassword?method=setlawypassword&id=%@&userpass=%@&udid=%@&src=%@&edition=%@&sig=%@",string_uid,password,string_dToken,Model,Version,string_sign]];

    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message)
            {
                [array_data addObject:@"系统发生错误"];
            }
            else
            {
                [array_data addObject:string_message];
                NSString *string_uid = [kindDic objectForKey:@"id"];
                NSString *string_token = [kindDic objectForKey:@"token"];
                if(string_uid){
                    [array_data addObject:string_uid];
                }
                if(string_token){
                    [array_data addObject:string_token];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 登录 -
/**
 *  登录
 */
//- (void )login_intPassword:(NSString *)string_password finishBlock:(requestResultBlock)resultBlock{
//    NSString *string_mobile = [Model_question sharedInstance].string_phone;
//    NSString *string_token = [[Model_user sharedInstance] getDeviceToken];
//    if(string_token){
//        
//    }
//    else{
//        string_token = @"";
//    }
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawylogin",string_mobile,string_password,string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=lawylogin&mobile=%@&userpass=%@&udid=%@&src=%@&edition=%@&sig=%@",string_mobile,string_password,string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_login;
//    _result_block = resultBlock;
//}
- (void )login_intPassword:(NSString *)string_password finishBlock:(requestResultBlock)resultBlock{
    NSString *string_mobile = [Model_question sharedInstance].string_phone;
    NSString *string_token = [[Model_user sharedInstance] getDeviceToken];
    if(string_token){
        
    }
    else{
        string_token = @"";
    }
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawylogin",string_mobile,string_password,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/lawylogin?method=lawylogin&mobile=%@&userpass=%@&udid=%@&src=%@&edition=%@&sig=%@",string_mobile,string_password,string_token,Model,Version,string_sign]];

    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:[string_url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message)
            {
                [array_data addObject:@"系统发生错误"];
            }
            else
            {
                [array_data addObject:string_message];
                NSString *string_uid = [kindDic objectForKey:@"id"];
                NSString *string_token = [kindDic objectForKey:@"token"];
                if(string_uid)
                {
                    [array_data addObject:string_uid];
                }
                
                if(string_token){
                    [array_data addObject:string_token];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:RequestErrorStr];
        resultBlock(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 退出登录 -
/**
 *  退出登录
 */
//- (void )login_outfinishBlock:(requestResultBlock)resultBlock{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    if(!string_uid){
//        string_uid = @"";
//    }
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"logout",string_uid,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=logout&id=%@&src=%@&edition=%@&sig=%@",string_uid,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_loginOut;
//    _result_block = resultBlock;
//}
- (void )login_outfinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    if(!string_uid){
        string_uid = @"";
    }
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"logout",string_uid,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/logout?method=logout&id=%@&src=%@&edition=%@&sig=%@",string_uid,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message)
            {
                [array_data addObject:@"系统发生错误"];
            }
            else
            {
                [array_data addObject:string_message];
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 获取等待回答问题列表 -
/**
 *  获取等待回答问题列表
 */
- (void)question_getWaitListFinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"getlawyanswlist",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/getlawyanswlist?method=getlawyanswlist&id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_token,Model,Version,string_sign]];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
    theRequest.timeoutInterval = 15;
    [theRequest setHTTPMethod:@"GET"];
    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
    connection.tag = KWNConnectionTag_getQuestionList;
    _result_block_two = resultBlock;
}

//- (void)question_getWaitListFinishStartNum:(NSInteger)startnum withResultBlock:(requestResultBlock)resultBlock
//{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"getlawyanswlist",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=getlawyanswlist&id=%@&start=%@&displaynum=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_getQuestionList;
//    _result_block_two = resultBlock;
//}

- (void)question_getWaitListFinishStartNum:(NSInteger)startnum withResultBlock:(requestResultBlock)resultBlock
{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"getlawyanswlist",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/getlawyanswlist?method=getlawyanswlist&id=%@&start=%@&displaynum=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            NSMutableArray *array_result = [NSMutableArray array];
            if(!number_code || !string_message)
            {
                [array_result addObject:@"系统发生错误"];
            }
            else
            {
                if(number_code.integerValue == 10000){
                    NSArray *array_data_tmp = [kindDic objectForKey:@"data"];
                    array_result = [KWNDealData deal_questListDataWithDicArray:array_data_tmp];
                }
                else{
                    [array_result addObject:string_message];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_result);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 获取正在回答问题列表 -
/**
 *  获取正在回答问题列表
 */
- (void)question_getNowListFinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"otherlawyansw",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/otherlawyansw?method=otherlawyansw&id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_token,Model,Version,string_sign]];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
    theRequest.timeoutInterval = 15;
    [theRequest setHTTPMethod:@"GET"];
    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
    connection.tag = KWNConnectionTag_getNowQuestionList;
    _result_block = resultBlock;
}

//- (void)question_getNowListFinishStartNum:(NSInteger)startnum withResultBlock:(requestResultBlock)resultBlock
//{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"otherlawyansw",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=otherlawyansw&id=%@&start=%@&displaynum=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_getNowQuestionList;
//    _result_block = resultBlock;
//
//}

- (void)question_getNowListFinishStartNum:(NSInteger)startnum withResultBlock:(requestResultBlock)resultBlock
{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"otherlawyansw",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/otherlawyansw?method=otherlawyansw&id=%@&start=%@&displaynum=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            NSMutableArray *array_result = [NSMutableArray array];
            if(!number_code || !string_message)
            {
                [array_result addObject:@"系统发生错误"];
            }
            else
            {
                if(number_code.integerValue == 10000){
                    NSArray *array_data_tmp = [kindDic objectForKey:@"data"];
                    array_result = [KWNDealData deal_questListDataWithDicArray:array_data_tmp];
                }
                else{
                    [array_result addObject:string_message];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_result);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 获取本律师回答问题列表 -
/**
 *  获取本律师回答问题列表
 */
- (void)question_getMyListFinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"getlawyanswinfo",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/getlawyanswinfo?method=getlawyanswinfo&id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_token,Model,Version,string_sign]];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
    theRequest.timeoutInterval = 15;
    [theRequest setHTTPMethod:@"GET"];
    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
    connection.tag = KWNConnectionTag_getMyQuestionList;
    _result_block = resultBlock;
}

//- (void)question_getMyListFinishStartNum:(NSInteger)startnum withResultBlock:(requestResultBlock)resultBlock;{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"getlawyanswinfo",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=getlawyanswinfo&id=%@&start=%@&displaynum=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_getMyQuestionList;
//    _result_block = resultBlock;
//
//}

- (void)question_getMyListFinishStartNum:(NSInteger)startnum withResultBlock:(requestResultBlock)resultBlock;{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"getlawyanswinfo",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/getlawyanswinfo?method=getlawyanswinfo&id=%@&start=%@&displaynum=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,[NSString stringWithFormat:@"%ld",(long)startnum],[NSString stringWithFormat:@"%d",kCountOfPage],string_token,Model,Version,string_sign]];

    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            NSMutableArray *array_result = [NSMutableArray array];
            if(!number_code || !string_message)
            {
                [array_result addObject:@"系统发生错误"];
            }
            else
            {
                if(number_code.integerValue == 10000){
                    NSArray *array_data_tmp = [kindDic objectForKey:@"data"];
                    array_result = [KWNDealData deal_myListDataWithDicArray:array_data_tmp];
                }
                else{
                    [array_result addObject:string_message];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_result);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 获取问题详情 -
/**
 *  获取问题详情
 */
//- (void)question_getQuestionDetailWithID:(NSString *)string_qID FinishBlock:(requestResultBlock)resultBlock{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyquestioninfos",string_uid,string_qID,string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=lawyquestioninfos&id=%@&question_id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_qID,string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_getQuestionDetail;
//    _result_block = resultBlock;
//}

- (void)question_getQuestionDetailWithID:(NSString *)string_qID FinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyquestioninfos",string_uid,string_qID,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/lawyquestioninfos?method=lawyquestioninfos&id=%@&question_id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_qID,string_token,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            NSMutableArray *array_result = [NSMutableArray array];
            if(!number_code || !string_message){
                [array_result addObject:@"系统发生错误"];
            }
            else{
                if(number_code.integerValue == 10000){
                    NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                    array_result = [KWNDealData deal_questDetailDataWithDic:dic_data_tmp];
                }
                else{
                    [array_result addObject:string_message];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_result);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 追问 -
/**
 *  追问
 */
- (void)question_sendAddQuestion:(Model_question *)model_question FinishBlock:(requestResultBlock)resultBlock{
    _result_block = resultBlock;
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSString *string_question_id = model_question.string_qID;
    NSMutableArray *array_image = model_question.array_imagePath;
    NSString *string_replyID = model_question.string_replyID;
    
    NSMutableArray *array_sort;
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    array_sort = [NSMutableArray arrayWithObjects:@"userask",string_uid,string_question_id,string_replyID,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    
    NSArray *array_object = @[@"userask",string_uid,model_question.string_text,@"",@"",@"",string_question_id,string_replyID,string_token,Model,Version,string_sign];
    NSArray *array_key = @[@"method",@"id",@"question",@"question_img1",@"question_img2",@"question_speech",@"reply_id",@"ask_reply_id",@"token",@"src",@"edition",@"sig"];
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjects:array_object forKeys:array_key];
    MKNetworkOperation* op = [engine operationWithURLString:KWNBaseURL_POST params:dic httpMethod:@"POST"];
    if(array_image){
        if(array_image.count == 1){
            NSString *path = array_image[0];
            [op addFile:path forKey:@"question_img1" mimeType:@"image/png"];
        }
        else{
            NSString *path1 = array_image[0];
            NSString *path2 = array_image[1];
            [op addFile:path1 forKey:@"question_img1" mimeType:@"image/png"];
            [op addFile:path2 forKey:@"question_img2" mimeType:@"image/png"];
        }
    }
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSNumber *number_code = [kindDic objectForKey:@"code"];
        NSString *string_msg = [kindDic objectForKey:@"msg"];
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:string_msg];
        _result_block(number_code.integerValue,array_data);
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"追问失败"];
        _result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 意见反馈 -
/**
 *  意见反馈
 */
- (void)question_sendFeedbackText:(NSString *)string_text FinishBlock:(requestResultBlock)resultBlock{
    _result_block = resultBlock;
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort;
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    array_sort = [NSMutableArray arrayWithObjects:@"lawyuserfeedback",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSArray *array_object = @[@"lawyuserfeedback",string_uid,string_text,string_token,Model,Version,string_sign];
    NSArray *array_key = @[@"method",@"id",@"feedback",@"token",@"src",@"edition",@"sig"];
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjects:array_object forKeys:array_key];
    MKNetworkOperation* op = [engine operationWithURLString:KWNBaseURL_POST params:dic httpMethod:@"POST"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSNumber *number_code = [kindDic objectForKey:@"code"];
        NSString *string_msg = [kindDic objectForKey:@"msg"];
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:string_msg];
        _result_block(number_code.integerValue,array_data);
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        _result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 采纳别人意见 -
/**
 *  采纳别人意见
 */
//- (void)question_questionAcceptWithID:(NSString *)string_qID adoptID:(NSString *)string_adoptID FinishBlock:(requestResultBlock)resultBlock{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"adopt",string_uid,string_qID,string_adoptID,string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=adopt&id=%@&question_id=%@&adopt_replyid=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_qID,string_adoptID,string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_questionAccept;
//    _result_block = resultBlock;
//}
- (void)question_questionAcceptWithID:(NSString *)string_qID adoptID:(NSString *)string_adoptID FinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"adopt",string_uid,string_qID,string_adoptID,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=adopt&id=%@&question_id=%@&adopt_replyid=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_qID,string_adoptID,string_token,Model,Version,string_sign]];


    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSMutableArray *array_data = [NSMutableArray array];

            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message){
                [array_data addObject:@"系统发生错误"];
            }
            else{
                [array_data addObject:string_message];
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 用户找回密码发送验证码 -
/**
 *  用户找回密码发送验证码
 */
//- (void)user_findMMPhone:(NSString *)string_phone FinishBlock:(requestResultBlock)resultBlock{
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"sendcode",string_phone,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=sendcode&mobile=%@&src=%@&edition=%@&sig=%@",string_phone,Model,Version,string_sign]];
//    
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_findMMGetMessage;
//    _result_block = resultBlock;
//}
- (void)user_findMMPhone:(NSString *)string_phone FinishBlock:(requestResultBlock)resultBlock{
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"sendcode",string_phone,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/sendcode?method=sendcode&mobile=%@&src=%@&edition=%@&sig=%@",string_phone,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message)
            {
                [array_data addObject:@"系统发生错误"];
            }
            else
            {
                [array_data addObject:string_message];
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 获取律师信息 -
/**
 *  获取律师信息
 */
- (void)lawyer_getLawyerInformationFinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyinfo",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURLOld stringByAppendingString:[NSString stringWithFormat:@"method=lawyinfo&id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_token,Model,Version,string_sign]];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            NSMutableArray *array_result = [NSMutableArray array];
            if(!number_code || !string_message){
                [array_result addObject:@"系统发生错误"];
            }
            else{
                if(number_code.integerValue == 10000){
                    NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                    array_result = [KWNDealData deal_lawyerInfoWithDic:dic_data_tmp];
                }
                else{
                    [array_result addObject:string_message];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_result);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"获取失败"];
        resultBlock(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 获取其他律师信息 -
/**
 *  获取其他律师信息
 */
//- (void)lawyer_getOtherLawyerInformation:(NSString *)string_lawyerID FinishBlock:(requestResultBlock)resultBlock{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"showlawyinfo",string_uid,string_lawyerID,string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=showlawyinfo&id=%@&show_lawyid=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_lawyerID,string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_getLawyerInfo;
//    _result_block = resultBlock;
//}
- (void)lawyer_getOtherLawyerInformation:(NSString *)string_lawyerID FinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"showlawyinfo",string_uid,string_lawyerID,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURLOld stringByAppendingString:[NSString stringWithFormat:@"method=showlawyinfo&id=%@&show_lawyid=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_lawyerID,string_token,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            NSMutableArray *array_result = [NSMutableArray array];
            if(!number_code || !string_message){
                [array_result addObject:@"系统发生错误"];
            }
            else{
                if(number_code.integerValue == 10000){
                    NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                    array_result = [KWNDealData deal_lawyerInfoWithDic:dic_data_tmp];
                }
                else{
                    [array_result addObject:string_message];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_result);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 问题评价 -
/**
 *  问题评价
 */
- (void)question_gradeWith:(Model_comment *)model FinishBlock:(requestResultBlock)resultBlock{
    _result_block = resultBlock;
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    //NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=comment&id=%@&question_id=%@&fuwu_fraction=%@&xy_fraction=%@&ziliang_fraction=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_lawyerID,string_token,Model,Version,string_sign]];
    NSMutableArray *array_sort;
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    array_sort = [NSMutableArray arrayWithObjects:@"comment",string_uid,model.string_qID,model.string_taidu,model.string_sudu,model.string_zhuanye,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSArray *array_object = @[@"comment",string_uid,model.string_qID,model.string_taidu,model.string_sudu,model.string_zhuanye,model.string_content,string_token,Model,Version,string_sign];
    NSArray *array_key = @[@"method",@"id",@"question_id",@"fuwu_fraction",@"xy_fraction",@"ziliang_fraction",@"content",@"token",@"src",@"edition",@"sig"];
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjects:array_object forKeys:array_key];
    MKNetworkOperation* op = [engine operationWithURLString:KWNBaseURL_POST params:dic httpMethod:@"POST"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSNumber *number_code = [kindDic objectForKey:@"code"];
        NSString *string_msg = [kindDic objectForKey:@"msg"];
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:string_msg];
        _result_block(number_code.integerValue,array_data);
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"评价失败"];
        _result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 更新推送信息数量 -
/**
 *  更新推送信息数量
 */
//- (void)push_upLoadPushNumber:(NSString *)string_count andQuestionID:(NSString *)string_qID FinishBlock:(requestResultBlock)resultBlock{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"unreadcount",string_uid,string_count,string_qID,string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=unreadcount&id=%@&unread=%@&question_id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_count,string_qID,string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_upLoadPush;
//    _result_block = resultBlock;
//}


- (void)push_upLoadPushNumber:(NSString *)string_count andQuestionID:(NSString *)string_qID FinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"unreadcount",string_uid,string_count,string_qID,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/unreadcount?method=unreadcount&id=%@&unread=%@&question_id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_count,string_qID,string_token,Model,Version,string_sign]];

    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];

    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSMutableArray *array_data = [NSMutableArray array];

            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message){
                [array_data addObject:@"系统发生错误"];
            }
            else{
                [array_data addObject:string_message];
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 查看评论 -
/**
 *  查看评论
 */
//- (void)question_getComment:(NSString *)string_questionID FinishBlock:(requestResultBlock)resultBlock{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyseecomment",string_uid,string_questionID,string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=lawyseecomment&id=%@&question_id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_questionID,string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_getComment;
//    _result_block = resultBlock;
//}


- (void)question_getComment:(NSString *)string_questionID FinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyseecomment",string_uid,string_questionID,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/lawyseecomment?method=lawyseecomment&id=%@&question_id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_questionID,string_token,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            NSMutableArray *array_result = [NSMutableArray array];
            if(!number_code || !string_message){
                [array_result addObject:@"系统发生错误"];
            }
            else{
                if(number_code.integerValue == 10000){
                    NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                    array_result = [KWNDealData deal_myComment:dic_data_tmp];
                }
                else{
                    [array_result addObject:string_message];
                }
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_result);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 同行律师点赞 -
/**
 *  同行律师点赞
 */
//- (void)lawyer_didClickGoodButtonWithReplyID:(NSString *)reply_id FinishBlock:(requestResultBlock)resultBlock{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"praise",string_uid,reply_id,string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=praise&id=%@&reply_id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,reply_id,string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_clickGood;
//    _result_block = resultBlock;
//}

- (void)lawyer_didClickGoodButtonWithReplyID:(NSString *)reply_id FinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"praise",string_uid,reply_id,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/praise?method=praise&id=%@&reply_id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,reply_id,string_token,Model,Version,string_sign]];
    
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSMutableArray *array_data = [NSMutableArray array];

            NSNumber *number_code = [kindDic objectForKey:@"code"];
            NSString *string_message = [kindDic objectForKey:@"msg"];
            if(!number_code || !string_message){
                [array_data addObject:@"系统发生错误"];
            }
            else{
                [array_data addObject:string_message];
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(number_code.integerValue,array_data);
            });
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
    
}

#pragma mark - 律师回答问题 -
/**
 *  律师回答问题
 */
- (void)send_answerQuestion:(NSString *)string_qID andText:(NSString *)string_content FinishBlock:(requestResultBlock)resultBlock{
    //NSLog(@"%@",[[Model_user sharedInstance] getDeviceToken]);
    _result_block = resultBlock;
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort;
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    array_sort = [NSMutableArray arrayWithObjects:@"lawyansw",string_uid,string_qID,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSArray *array_object = @[@"lawyansw",string_uid,string_qID,string_content,@"",@"",@"",string_token,Model,Version,string_sign];
    NSArray *array_key = @[@"method",@"id",@"question_id",@"content",@"content_img1",@"content_img2",@"content_speech",@"token",@"src",@"edition",@"sig"];
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjects:array_object forKeys:array_key];
    NSString *string_url = [KWNBaseURL_POST stringByAppendingString:@"lawyer/lawyansw"];

    MKNetworkOperation* op = [engine operationWithURLString:string_url params:dic httpMethod:@"POST"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        NSNumber *number_code = [kindDic objectForKey:@"code"];
        NSString *string_message = [kindDic objectForKey:@"msg"];
        if(!number_code || !string_message){
            [array_data addObject:@"系统发生错误"];
        }
        else{
            [array_data addObject:string_message];
        }
        _result_block(number_code.integerValue,array_data);
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"链接超时"];
        _result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 编辑律师简介 -
/**
 *  编辑律师简介
 */
- (void)edit_laywerIntroduction:(NSString *)string_tro FinishBlock:(requestResultBlock)resultBlock{
    _result_block = resultBlock;
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort;
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    array_sort = [NSMutableArray arrayWithObjects:@"updatelawyintro",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSArray *array_object = @[@"updatelawyintro",string_uid,string_tro,string_token,Model,Version,string_sign];
    NSArray *array_key = @[@"method",@"id",@"intro",@"token",@"src",@"edition",@"sig"];
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjects:array_object forKeys:array_key];
    
    NSString *string_url = [KWNBaseURL_POST stringByAppendingString:@"lawyer/updatelawyintro"];
    MKNetworkOperation* op = [engine operationWithURLString:string_url params:dic httpMethod:@"POST"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        NSNumber *number_code = [kindDic objectForKey:@"code"];
        NSString *string_message = [kindDic objectForKey:@"msg"];
        if(!number_code || !string_message){
            [array_data addObject:@"系统发生错误"];
        }
        else{
            [array_data addObject:string_message];
        }
        _result_block(number_code.integerValue,array_data);
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"回答失败"];
        _result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 编辑律师签名 -
/**
 *  编辑律师签名
 */
- (void)edit_laywerSign:(NSString *)string_signature FinishBlock:(requestResultBlock)resultBlock{
    _result_block = resultBlock;
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort;
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    array_sort = [NSMutableArray arrayWithObjects:@"updatelawysignatu",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSArray *array_object = @[@"updatelawysignatu",string_uid,string_signature,string_token,Model,Version,string_sign];
    NSArray *array_key = @[@"method",@"id",@"signatu",@"token",@"src",@"edition",@"sig"];
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjects:array_object forKeys:array_key];
    NSString *string_url = [KWNBaseURL_POST stringByAppendingString:@"lawyer/updatelawysignatu"];

    MKNetworkOperation* op = [engine operationWithURLString:string_url params:dic httpMethod:@"POST"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSMutableArray *array_data = [NSMutableArray array];
        NSNumber *number_code = [kindDic objectForKey:@"code"];
        NSString *string_message = [kindDic objectForKey:@"msg"];
        if(!number_code || !string_message){
            [array_data addObject:@"系统发生错误"];
        }
        else{
            [array_data addObject:string_message];
        }
        _result_block(number_code.integerValue,array_data);
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"链接超时"];
        _result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 编辑律师头像 -
/**
 *  编辑律师头像
 */
- (void)edit_laywerPortrait:(NSString *)string_portrait FinishBlock:(requestResultBlock)resultBlock{
    _result_block = resultBlock;
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort;
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    array_sort = [NSMutableArray arrayWithObjects:@"updatelawyphoto",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSArray *array_object = @[@"updatelawyphoto",string_uid,@"",string_token,Model,Version,string_sign];
    NSArray *array_key = @[@"method",@"id",@"headsrc",@"token",@"src",@"edition",@"sig"];
    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjects:array_object forKeys:array_key];
    NSString *string_url = [KWNBaseURL_POST stringByAppendingString:@"lawyer/updatelawyphoto"];

    MKNetworkOperation* op = [engine operationWithURLString:string_url params:dic httpMethod:@"POST"];
    [op addFile:string_portrait forKey:@"headsrc" mimeType:@"image/png"];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSNumber *number_code = [kindDic objectForKey:@"code"];
        NSString *string_msg = [kindDic objectForKey:@"msg"];
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:string_msg];
        _result_block(number_code.integerValue,array_data);
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"上传失败"];
        _result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 每天第一次打开app -
/**
 *  每天第一次打开app
 */
//- (void)score_openAppFirstOneDay{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyfirstopenapp",string_uid,string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=lawyfirstopenapp&id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_token,Model,Version,string_sign]];
//    
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = KWNConnectionTag_appOpen;
//}
- (void)score_openAppFirstOneDay{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyfirstopenapp",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/lawyfirstopenapp?method=lawyfirstopenapp&id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_token,Model,Version,string_sign]];
    
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        //NSError *error;
        //NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 分享app -
/**
 *  分享app
 */
//- (void)score_shareApp{
//    NSString *string_uid = [[Model_user sharedInstance] getUserID];
//    NSString *string_token = [[Model_user sharedInstance] getToken];
//    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyshare",string_uid,string_token,Model,Version,nil];
//    NSString *string_sign = [self getSignWithArray:array_sort];
//    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"method=lawyshare&id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_token,Model,Version,string_sign]];
//    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:string_url]];
//    theRequest.timeoutInterval = 15;
//    [theRequest setHTTPMethod:@"GET"];
//    KWNURLConnection *connection = [[KWNURLConnection alloc] initWithRequest:theRequest delegate:self];
//    connection.tag = 201;
//}
- (void)score_shareApp{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort = [NSMutableArray arrayWithObjects:@"lawyshare",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/lawyshare?method=lawyshare&id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_token,Model,Version,string_sign]];
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        //NSError *error;
        //NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        });
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        //NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        //_result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];

}

#pragma mark - 获取是否有未读信息 -
/**
 *  获取是否有未读信息
 */
- (void)push_getNewNotifacationFinishBlock:(requestResultBlock)resultBlock{
    NSString *string_uid = [[Model_user sharedInstance] getUserID];
    NSString *string_token = [[Model_user sharedInstance] getToken];
    NSMutableArray *array_sort;
    MKNetworkEngine* engine = [[MKNetworkEngine alloc]init];
    array_sort = [NSMutableArray arrayWithObjects:@"lawygetunread",string_uid,string_token,Model,Version,nil];
    NSString *string_sign = [self getSignWithArray:array_sort];
    NSString *string_url = [KWNBaseURL stringByAppendingString:[NSString stringWithFormat:@"lawyer/getunread?method=getunread&id=%@&token=%@&src=%@&edition=%@&sig=%@",string_uid,string_token,Model,Version,string_sign]];
    MKNetworkOperation* op = [engine operationWithURLString:string_url];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSError *error;
        NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:completedOperation.responseData options:NSJSONReadingMutableLeaves error:&error];
        NSNumber *number_code = [kindDic objectForKey:@"code"];
        NSString *string_msg = [kindDic objectForKey:@"msg"];
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:string_msg];
        _result_block(number_code.integerValue,array_data);
    }errorHandler:^(MKNetworkOperation *completedOperation,NSError *error) {
        NSMutableArray *array_data = [NSMutableArray arrayWithObject:@"反馈失败"];
        _result_block(10001,array_data);
    }];
    [engine enqueueOperation:op];
}

#pragma mark - 网络链接回调 -
/*
 *NSURLConnectionDelegate
 */
- (void)connection:(NSURLConnection *)aConnection didReceiveResponse:(NSURLResponse *)aResponse{
    NSHTTPURLResponse *resp = (NSHTTPURLResponse*)aResponse;
    [_webData setLength:0];
    if (resp) {
        //_int_codeSign = resp.statusCode;
    }
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
    [_webData appendData:data];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
    //NSString *stringData = [[NSString alloc] initWithData:_webData encoding: NSUTF8StringEncoding];
    //NSLog(@"%@",stringData);
    KWNURLConnection *connect = (KWNURLConnection *)connection;
    NSError *error;
    NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:_webData options:NSJSONReadingMutableLeaves error:&error];
    NSMutableArray *array_data = [NSMutableArray array];
    switch (connect.tag) {
        case KWNConnectionTag_verifyPhone:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                    NSString *string_uid = [kindDic objectForKey:@"id"];
                    if(string_uid){
                        [array_data addObject:string_uid];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_finish:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                    NSString *string_uid = [kindDic objectForKey:@"id"];
                    NSString *string_token = [kindDic objectForKey:@"token"];
                    if(string_uid){
                        [array_data addObject:string_uid];
                    }
                    if(string_token){
                        [array_data addObject:string_token];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_send:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_login:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                    NSString *string_uid = [kindDic objectForKey:@"id"];
                    NSString *string_token = [kindDic objectForKey:@"token"];
                    if(string_uid){
                        [array_data addObject:string_uid];
                    }
                    if(string_token){
                        [array_data addObject:string_token];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_getQuestionList:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSArray *array_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_questListDataWithDicArray:array_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block_two(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getNowQuestionList:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    //[array_result addObject:string_message];
                    if(number_code.integerValue == 10000){
                        NSArray *array_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_questListDataWithDicArray:array_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getMyQuestionList:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    //[array_result addObject:string_message];
                    if(number_code.integerValue == 10000){
                        NSArray *array_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_myListDataWithDicArray:array_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getQuestionDetail:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_questDetailDataWithDic:dic_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_findMMGetMessage:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_getLawyerInfo:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_lawyerInfoWithDic:dic_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getComment:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_myComment:dic_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getNewCount:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSString *string_unread = [kindDic objectForKey:@"unread"];
                        [array_data addObject:string_message];
                        [array_data addObject:string_unread];
                    }
                    else{
                        [array_data addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_clickGood:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_editIntro:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_editSign:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_appOpen:{
            return;
        }break;
        default:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
    }
    [connection cancel];
}

/*- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
    NSString *stringData = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
    NSLog(@"%@",stringData);
    if([stringData isEqualToString:@"1"]){
        return;
    }
    KWNURLConnection *connect = (KWNURLConnection *)connection;
    NSError *error;
    NSDictionary *kindDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
    NSMutableArray *array_data = [NSMutableArray array];
    switch (connect.tag) {
        case KWNConnectionTag_verifyPhone:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                    NSString *string_uid = [kindDic objectForKey:@"id"];
                    if(string_uid){
                        [array_data addObject:string_uid];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_finish:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                    NSString *string_uid = [kindDic objectForKey:@"id"];
                    NSString *string_token = [kindDic objectForKey:@"token"];
                    if(string_uid){
                        [array_data addObject:string_uid];
                    }
                    if(string_token){
                        [array_data addObject:string_token];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_send:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_login:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                    NSString *string_uid = [kindDic objectForKey:@"id"];
                    NSString *string_token = [kindDic objectForKey:@"token"];
                    if(string_uid){
                        [array_data addObject:string_uid];
                    }
                    if(string_token){
                        [array_data addObject:string_token];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_getQuestionList:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSArray *array_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_questListDataWithDicArray:array_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block_two(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getNowQuestionList:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    //[array_result addObject:string_message];
                    if(number_code.integerValue == 10000){
                        NSArray *array_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_questListDataWithDicArray:array_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getMyQuestionList:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    //[array_result addObject:string_message];
                    if(number_code.integerValue == 10000){
                        NSArray *array_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_myListDataWithDicArray:array_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getQuestionDetail:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_questDetailDataWithDic:dic_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_findMMGetMessage:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_getLawyerInfo:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_lawyerInfoWithDic:dic_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getComment:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                NSMutableArray *array_result = [NSMutableArray array];
                if(!number_code || !string_message){
                    [array_result addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSDictionary *dic_data_tmp = [kindDic objectForKey:@"data"];
                        array_result = [KWNDealData deal_myComment:dic_data_tmp];
                    }
                    else{
                        [array_result addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_result);
                });
            });
        }break;
        case KWNConnectionTag_getNewCount:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    if(number_code.integerValue == 10000){
                        NSString *string_unread = [kindDic objectForKey:@"unread"];
                        [array_data addObject:string_message];
                        [array_data addObject:string_unread];
                    }
                    else{
                        [array_data addObject:string_message];
                    }
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_clickGood:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_editIntro:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_editSign:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
        case KWNConnectionTag_appOpen:{
            return;
        }break;
        default:{
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                NSNumber *number_code = [kindDic objectForKey:@"code"];
                NSString *string_message = [kindDic objectForKey:@"msg"];
                if(!number_code || !string_message){
                    [array_data addObject:@"系统发生错误"];
                }
                else{
                    [array_data addObject:string_message];
                }
                dispatch_async(dispatch_get_main_queue(), ^{
                    _result_block(number_code.integerValue,array_data);
                });
            });
        }break;
    }
}*/

- (void)connection:(NSURLConnection *)aConn didFailWithError:(NSError *)error{
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    [aConn cancel];
    NSString* msg = [error localizedDescription];
    _int_codeSign = 10;
    NSMutableArray *array_tmp = [NSMutableArray arrayWithObject:msg];
    _result_block(_int_codeSign,array_tmp);
    // NSLog(@"Connection failed: %@", msg); // 错误信息
}


@end
